/*     */ package com.feeyin.radar.sys.controller;
/*     */ 
/*     */ import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import com.feeyin.radar.commons.Page;
import com.feeyin.radar.commons.StringUtils;
import com.feeyin.radar.crm.form.SaleFunnelForm;
import com.feeyin.radar.crm.model.QueryViewNum;
import com.feeyin.radar.crm.service.AuditManageService;
import com.feeyin.radar.crm.service.ContractService;
import com.feeyin.radar.crm.service.CustomerService;
import com.feeyin.radar.crm.service.SaleCostService;
import com.feeyin.radar.crm.service.SaleFunnelService;
import com.feeyin.radar.crm.service.SaleRecordService;
import com.feeyin.radar.msg.service.EmployeeBBSService;
import com.feeyin.radar.msg.service.InternalMailboxService;
import com.feeyin.radar.msg.service.NewsNoticeService;
import com.feeyin.radar.msg.service.WarningInfoService;
import com.feeyin.radar.sys.service.FunctionTreeService;
import com.feeyin.radar.sys.service.RecordRangeService;
import com.feeyin.radar.sys.service.RoleService;
import com.feeyin.radar.sys.service.SaleAssistantService;
import com.feeyin.radar.sys.service.SaleStageSetService;
import com.feeyin.radar.sys.service.WarningService;
/*     */ 
/*     */ public class IndexController extends MultiActionController
/*     */ {
/*     */   private FunctionTreeService functionTreeService;
/*     */   private SaleAssistantService saleAssistantService;
/*     */   private NewsNoticeService newsNoticeService;
/*     */   private EmployeeBBSService employeeBBSService;
/*     */   private WarningInfoService warningInfoService;
/*     */   private WarningService warningService;
/*     */   private RecordRangeService recordRangeService;
/*     */   private SaleFunnelService saleFunnelService;
/*     */   private CustomerService customerService;
/*     */   private SaleStageSetService saleStageSetService;
/*     */   private ContractService contractService;
/*     */   private AuditManageService auditManageService;
/*     */   private SaleCostService saleCostService;
/*     */   private InternalMailboxService internalMailboxService;
/*     */   private SaleRecordService saleRecordService;
/*     */   private RoleService roleService;
/*     */   private String index;
/*     */   private String top;
/*     */   private String middle;
/*     */   private String foot;
/*     */   private String leftMenu;
/*     */   private String main;
/*     */   private String rightMenu;
/*     */   private String editView;
/*     */ 
/*     */   public RoleService getRoleService()
/*     */   {
/*  61 */     return this.roleService;
/*     */   }
/*     */ 
/*     */   public void setRoleService(RoleService roleService) {
/*  65 */     this.roleService = roleService;
/*     */   }
/*     */ 
/*     */   public SaleRecordService getSaleRecordService() {
/*  69 */     return this.saleRecordService;
/*     */   }
/*     */ 
/*     */   public void setSaleRecordService(SaleRecordService saleRecordService) {
/*  73 */     this.saleRecordService = saleRecordService;
/*     */   }
/*     */ 
/*     */   public String getEditView()
/*     */   {
/*  85 */     return this.editView;
/*     */   }
/*     */ 
/*     */   public void setEditView(String editView) {
/*  89 */     this.editView = editView;
/*     */   }
/*     */ 
/*     */   public String getIndex() {
/*  93 */     return this.index;
/*     */   }
/*     */ 
/*     */   public FunctionTreeService getFunctionTreeService() {
/*  97 */     return this.functionTreeService;
/*     */   }
/*     */ 
/*     */   public void setFunctionTreeService(FunctionTreeService functionTreeService) {
/* 101 */     this.functionTreeService = functionTreeService;
/*     */   }
/*     */ 
/*     */   public SaleAssistantService getSaleAssistantService()
/*     */   {
/* 113 */     return this.saleAssistantService;
/*     */   }
/*     */ 
/*     */   public void setSaleAssistantService(SaleAssistantService saleAssistantService) {
/* 117 */     this.saleAssistantService = saleAssistantService;
/*     */   }
/*     */ 
/*     */   public NewsNoticeService getNewsNoticeService() {
/* 121 */     return this.newsNoticeService;
/*     */   }
/*     */ 
/*     */   public void setNewsNoticeService(NewsNoticeService newsNoticeService) {
/* 125 */     this.newsNoticeService = newsNoticeService;
/*     */   }
/*     */ 
/*     */   public EmployeeBBSService getEmployeeBBSService() {
/* 129 */     return this.employeeBBSService;
/*     */   }
/*     */ 
/*     */   public void setEmployeeBBSService(EmployeeBBSService employeeBBSService) {
/* 133 */     this.employeeBBSService = employeeBBSService;
/*     */   }
/*     */ 
/*     */   public WarningInfoService getWarningInfoService() {
/* 137 */     return this.warningInfoService;
/*     */   }
/*     */ 
/*     */   public void setWarningInfoService(WarningInfoService warningInfoService) {
/* 141 */     this.warningInfoService = warningInfoService;
/*     */   }
/*     */ 
/*     */   public WarningService getWarningService() {
/* 145 */     return this.warningService;
/*     */   }
/*     */ 
/*     */   public void setWarningService(WarningService warningService) {
/* 149 */     this.warningService = warningService;
/*     */   }
/*     */ 
/*     */   public RecordRangeService getRecordRangeService() {
/* 153 */     return this.recordRangeService;
/*     */   }
/*     */ 
/*     */   public void setRecordRangeService(RecordRangeService recordRangeService) {
/* 157 */     this.recordRangeService = recordRangeService;
/*     */   }
/*     */ 
/*     */   public SaleFunnelService getSaleFunnelService() {
/* 161 */     return this.saleFunnelService;
/*     */   }
/*     */ 
/*     */   public void setSaleFunnelService(SaleFunnelService saleFunnelService) {
/* 165 */     this.saleFunnelService = saleFunnelService;
/*     */   }
/*     */ 
/*     */   public CustomerService getCustomerService() {
/* 169 */     return this.customerService;
/*     */   }
/*     */ 
/*     */   public void setCustomerService(CustomerService customerService) {
/* 173 */     this.customerService = customerService;
/*     */   }
/*     */ 
/*     */   public SaleStageSetService getSaleStageSetService() {
/* 177 */     return this.saleStageSetService;
/*     */   }
/*     */ 
/*     */   public void setSaleStageSetService(SaleStageSetService saleStageSetService) {
/* 181 */     this.saleStageSetService = saleStageSetService;
/*     */   }
/*     */ 
/*     */   public ContractService getContractService() {
/* 185 */     return this.contractService;
/*     */   }
/*     */ 
/*     */   public void setContractService(ContractService contractService) {
/* 189 */     this.contractService = contractService;
/*     */   }
/*     */ 
/*     */   public AuditManageService getAuditManageService() {
/* 193 */     return this.auditManageService;
/*     */   }
/*     */ 
/*     */   public void setAuditManageService(AuditManageService auditManageService) {
/* 197 */     this.auditManageService = auditManageService;
/*     */   }
/*     */ 
/*     */   public SaleCostService getSaleCostService() {
/* 201 */     return this.saleCostService;
/*     */   }
/*     */ 
/*     */   public void setSaleCostService(SaleCostService saleCostService) {
/* 205 */     this.saleCostService = saleCostService;
/*     */   }
/*     */ 
/*     */   public InternalMailboxService getInternalMailboxService() {
/* 209 */     return this.internalMailboxService;
/*     */   }
/*     */ 
/*     */   public void setInternalMailboxService(InternalMailboxService internalMailboxService)
/*     */   {
/* 214 */     this.internalMailboxService = internalMailboxService;
/*     */   }
/*     */ 
/*     */   public void setIndex(String index) {
/* 218 */     this.index = index;
/*     */   }
/*     */   public String getTop() {
/* 221 */     return this.top;
/*     */   }
/*     */   public void setTop(String top) {
/* 224 */     this.top = top;
/*     */   }
/*     */   public String getMiddle() {
/* 227 */     return this.middle;
/*     */   }
/*     */   public void setMiddle(String middle) {
/* 230 */     this.middle = middle;
/*     */   }
/*     */   public String getFoot() {
/* 233 */     return this.foot;
/*     */   }
/*     */   public void setFoot(String foot) {
/* 236 */     this.foot = foot;
/*     */   }
/*     */   public String getLeftMenu() {
/* 239 */     return this.leftMenu;
/*     */   }
/*     */   public void setLeftMenu(String leftMenu) {
/* 242 */     this.leftMenu = leftMenu;
/*     */   }
/*     */   public String getMain() {
/* 245 */     return this.main;
/*     */   }
/*     */   public void setMain(String main) {
/* 248 */     this.main = main;
/*     */   }
/*     */   public String getRightMenu() {
/* 251 */     return this.rightMenu;
/*     */   }
/*     */   public void setRightMenu(String rightMenu) {
/* 254 */     this.rightMenu = rightMenu;
/*     */   }
/*     */ 
/*     */   public ModelAndView display(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 259 */     return new ModelAndView(getIndex());
/*     */   }
/*     */ 
/*     */   public ModelAndView topPage(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 264 */     return new ModelAndView(getTop());
/*     */   }
/*     */ 
/*     */   public ModelAndView middlePage(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 269 */     return new ModelAndView(getMiddle());
/*     */   }
/*     */ 
/*     */   public ModelAndView footPage(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 274 */     return new ModelAndView(getFoot());
/*     */   }
/*     */ 
/*     */   public ModelAndView leftMenuPage(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 279 */     Map model = new HashMap();
/* 280 */     Integer userId = (Integer)request.getSession().getAttribute("userId");
/*     */ 
/* 282 */     List functions = new ArrayList();
/* 283 */     functions = (List)request.getSession().getAttribute("functionTree");
/* 284 */     model.put("functions", functions);
/*     */ 
/* 286 */     model.put("noReadNum", this.internalMailboxService.getNoReadInternalMailCount(userId));
/*     */ 
/* 288 */     return new ModelAndView(getLeftMenu(), model);
/*     */   }
/*     */ 
/*     */   public ModelAndView mainPage(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 293 */     Map model = new HashMap();
/*     */ 
/* 295 */     Integer userId = (Integer)request.getSession().getAttribute("userId");
/*     */ 
/* 297 */     model.put("buinessTarget", this.saleAssistantService.getBusinessTarget(userId));
/*     */ 
/* 299 */     model.put("warningWay", this.warningService.getWarningWay());
/*     */ 
/* 301 */     Page page = new Page();
/* 302 */     page.getPageList(this.newsNoticeService.getPageNewsNoticesCount(null).intValue(), Integer.valueOf(3), request);
/*     */ 
/* 304 */     model.put("newsNotices", this.newsNoticeService.getPageNewsNotices(page, null));
/*     */ 
/* 307 */     page = new Page();
/* 308 */     page.getPageList(this.employeeBBSService.getPageEmployeeBBSsCount(null).intValue(), Integer.valueOf(2), request);
/*     */ 
/* 310 */     model.put("employeeBBSs", this.employeeBBSService.getPageEmployeeBBSs(page, null));
/*     */ 
/* 312 */     page = new Page();
/* 313 */     page.getPageList(this.warningInfoService.getPageScheduleWarningInfosCountByUserId(userId).intValue(), Integer.valueOf(5), request);
/*     */ 
/* 315 */     model.put("warningInfoBySchedules", this.warningInfoService.getPageScheduleWarningInfosByUserId(userId, page));
/*     */ 
/* 317 */     model.put("contactWays", this.recordRangeService.getActivityRecordRangesByDictionaryCode("34"));
/*     */ 
/* 319 */     page = new Page();
/* 320 */     page.getPageList(this.warningInfoService.getPageSystemWarningInfosCountByUserId(userId).intValue(), Integer.valueOf(2), request);
/*     */ 
/* 322 */     model.put("warningInfoBySystems", this.warningInfoService.getPageSystemWarningInfosByUserId(userId, page));
/*     */ 
/* 324 */     SaleFunnelForm saleFunnelForm = new SaleFunnelForm();
/* 325 */     saleFunnelForm.setFunnelTarget("1");
/* 326 */     saleFunnelForm.setSalePersonId(userId);
/* 327 */     saleFunnelForm.setTime("1");
/* 328 */     model.put("saleStages", this.saleFunnelService.getSaleFunnel(userId, saleFunnelForm));
/*     */ 
/* 331 */     model.put("customers", this.customerService.getNearViewCustomersByUserId(userId));
/*     */ 
/* 334 */     model.put("saleCustomers", this.customerService.getSaleStageUpdateCustomersByUserId(userId));
/* 335 */     model.put("usaleStages", this.saleStageSetService.getSaleStages());
/*     */ 
/* 338 */     if (this.warningService.isUseAuditWarningByUserId(userId)) {
/* 339 */       String auditAllInvoice = "";
/* 340 */       String auditDeptInvoice = "";
/*     */ 
/* 342 */       if (request.getSession().getAttribute("isAuditAllInvoice") != null) {
/* 343 */         auditAllInvoice = (String)request.getSession().getAttribute("isAuditAllInvoice");
/*     */       }
/* 345 */       if (request.getSession().getAttribute("isAuditDeptInvoice") != null) {
/* 346 */         auditDeptInvoice = (String)request.getSession().getAttribute("isAuditDeptInvoice");
/*     */       }
/* 348 */       int sign = 0;
/* 349 */       if ((!StringUtils.isEmpty(auditAllInvoice)) && ("1".equals(auditAllInvoice)))
/* 350 */         sign = 1;
/* 351 */       else if ((!StringUtils.isEmpty(auditDeptInvoice)) && ("1".equals(auditDeptInvoice))) {
/* 352 */         sign = 2;
/*     */       }
/* 354 */       page = new Page();
/* 355 */       page.getPageList(this.auditManageService.getPageAuditContractsCount(sign, userId).intValue(), Integer.valueOf(1), request);
/*     */ 
/* 357 */       model.put("auditContracts", this.auditManageService.getPageAuditContracts(sign, userId, page));
/* 358 */       page = new Page();
/* 359 */       page.getPageList(this.contractService.getPageMyContractsCount(null, "2", null, userId, null).intValue(), Integer.valueOf(1), request);
/*     */ 
/* 361 */       model.put("passContracts", this.contractService.getPageMyContracts(null, "2", null, userId, page, null));
/* 362 */       page = new Page();
/* 363 */       page.getPageList(this.contractService.getPageMyContractsCount(null, "3", null, userId, null).intValue(), Integer.valueOf(1), request);
/*     */ 
/* 365 */       model.put("returnContracts", this.contractService.getPageMyContracts(null, "3", null, userId, page, null));
/*     */ 
/* 367 */       page = new Page();
/* 368 */       page.getPageList(this.auditManageService.getPageAuditSaleCostsCount(sign, userId).intValue(), Integer.valueOf(1), request);
/*     */ 
/* 370 */       model.put("auditSaleCosts", this.auditManageService.getPageAuditSaleCosts(sign, userId, page));
/* 371 */       page = new Page();
/* 372 */       page.getPageList(this.saleCostService.getPageSaleCostsCount(null, "2", userId).intValue(), Integer.valueOf(1), request);
/*     */ 
/* 374 */       model.put("passSaleCosts", this.saleCostService.getPageSaleCosts(null, "2", userId, page));
/* 375 */       page = new Page();
/* 376 */       page.getPageList(this.saleCostService.getPageSaleCostsCount(null, "3", userId).intValue(), Integer.valueOf(1), request);
/*     */ 
/* 378 */       model.put("returnSaleCosts", this.saleCostService.getPageSaleCosts(null, "3", userId, page));
/*     */     }
/*     */ 
/* 382 */     return new ModelAndView(getMain(), model);
/*     */   }
/*     */ 
/*     */   public ModelAndView rightMenuPage(HttpServletRequest request, HttpServletResponse response)
/*     */   {
/* 387 */     Map map = new HashMap();
/* 388 */     Integer userId = (Integer)request.getSession().getAttribute("userId");
/*     */ 
/* 390 */     map.put("buinessTarget", this.saleAssistantService.getBusinessTarget(userId));
/* 391 */     return new ModelAndView(getRightMenu(), map);
/*     */   }
/*     */   public ModelAndView mes(HttpServletRequest request, HttpServletResponse response) {
/* 394 */     Integer userId = (Integer)request.getSession().getAttribute("userId");
/* 395 */     Integer num = this.internalMailboxService.getNoReadInternalMailCount(userId);
/* 396 */     Integer num1 = this.saleRecordService.getCurrentDateRecordCount(userId);
/*     */ 
/* 398 */     response.setContentType("text/xml;charset=UTF-8");
/*     */ 
/* 401 */     response.setHeader("Cache-Control", "no-store");
/* 402 */     response.setHeader("Pragma", "no-cache");
/* 403 */     response.setDateHeader("Expires", 0L);
/*     */     try
/*     */     {
/* 406 */       if ((num.intValue() != 0) || (num1.intValue() != 0)) {
/* 407 */         response.getWriter().write("<msg>");
/*     */ 
/* 409 */         response.getWriter().write("<s>您有&lt;/font&gt;&lt;font color='red' size='2px' &gt; " + num + "  &lt;/font&gt;&lt;font style='font-weight: normal'&gt;封未读邮件！</s>");
/*     */ 
/* 412 */         response.getWriter().write("<b>您今天有&lt;/font&gt;&lt;font color='red' size='2px' &gt; " + num1 + "  &lt;/font&gt;&lt;font style='font-weight: normal'&gt;个日程安排！</b>");
/*     */ 
/* 415 */         response.getWriter().write("</msg>");
/*     */       } else {
/* 417 */         response.getWriter().write("11");
/*     */       }
/*     */     }
/*     */     catch (IOException e) {
/* 421 */       e.printStackTrace();
/*     */     }
/* 423 */     return null;
/*     */   }
/*     */   public ModelAndView test(HttpServletRequest request, HttpServletResponse response, QueryViewNum queryviewnum) {
/* 426 */     Map model = new HashMap();
/* 427 */     model.put("queryviewnum", queryviewnum);
/* 428 */     return new ModelAndView(getMain(), model);
/*     */   }
/*     */ 
/*     */   public ModelAndView editView(HttpServletRequest request, HttpServletResponse response) {
/* 432 */     Integer userId = (Integer)request.getSession().getAttribute("userId");
/* 433 */     Map model = new HashMap();
/* 434 */     model.put("viewfuns", this.roleService.getViewRoleFunctionsByUserId(userId));
/* 435 */     model.put("userviewfuns", this.roleService.getUserViewFunPosition(userId));
/* 436 */     return new ModelAndView(getEditView(), model);
/*     */   }
/*     */ }

/* Location:           C:\Users\e547415\MyProject\rone\WEB-INF\classes\
 * Qualified Name:     com.feeyin.radar.sys.controller.IndexController
 * JD-Core Version:    0.6.0
 */